package cn.forward.template;

import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;

public class FeignAnToKtnTemplate implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {

        String tokenName = StpUtil.getTokenName();
        String tokenValue = StpUtil.getTokenValue();
        if (StrUtil.isNotEmpty(tokenName) && StrUtil.isNotEmpty(tokenValue)) {

            requestTemplate.header(tokenName, tokenValue);

        }
    }

}
